package com.woniuxy.ui;

import com.woniuxy.entity.Student;
import com.woniuxy.service.StudentService;
import com.woniuxy.service.impl.StudentServiceImpl;

import java.util.Scanner;

/**
 * @author 作者
 * @create 2025-06-11 16:37
 */
public class Application {
    public static void main(String[] args) {
        System.out.println(new StudentServiceImpl().getAll());
    }

    private static void login() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入姓名:");
        String sname=scanner.next();
        System.out.println("输入密码:");
        String pwd=scanner.next();
        StudentService studentService=new StudentServiceImpl();
        try {
            studentService.login(sname,pwd);
            System.out.println("登录成功，进入系统");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

    private static void regist() {
        System.out.println("提示输入学生信息，创建学生对象，调用业务层方法");
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入姓名:");
        String sname=scanner.next();
        System.out.println("输入密码:");
        String pwd=scanner.next();
        System.out.println("输入年龄:");
        int age=scanner.nextInt();
        System.out.println("输入邮箱:");
        String email=scanner.next();
        Student student=new Student(null,sname,pwd,age,email);
        try {
            new StudentServiceImpl().register(student);
            System.out.println("注册成功");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
